package com.liu.zuihou.controtller;


import com.liu.liuhantao.entity.Student;
import com.liu.liuhantao.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

//@Controller
//@ResponseBody
@RestController
public class StudentController {
    //通过id查找学生数据
//    @RequestMapping(value = "/students/{id}",method = RequestMethod.GET)
    @Autowired
    StudentMapper studentMapper;

    @GetMapping(value = "/students/{id}")
    public Object student(@PathVariable("id") int id) {
        Student student = new Student();
        student.setId(id);
        return studentMapper.findById(id);
    }
}
